//
//  IdentifyCardController.m
//  ATMCash
//
//  Created by zhengchengfeng on 2024/9/12.
//

#import "IdentifyCardController.h"
#import "FaceViewController.h"

#import "PickerOneView.h"
#import "PickerTwoView.h"

#import "YearMonthDayPickerView.h"

#define kFootViewHeight  (15 + 48 + (IS_IPhoneX_All ? kHeight_BottomSafe : 15))

@interface IdentifyCardController ()

@property (nonatomic) UIImageView *cardImgView;
@property (nonatomic) CreditTextFiled *fullNameFiled,*IDNoFiled,*DateFiled;

@property (nonatomic) NSString *clickTimeStr;

@property (nonatomic) NSString *nameStr,*idNoStr,*dateStr;

@end

@implementation IdentifyCardController

- (void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    [self.navigationController setNavigationBarHidden:NO animated:animated];
}

- (void)initFootView{

    UIView *bottomV = [[UIView alloc] initWithFrame:CGRectMake(0, kScreenHeight - kFootViewHeight - kNavigationBarHeight, kScreenWidth, kFootViewHeight)];
    bottomV.backgroundColor = [UIColor whiteColor];
    [self.view addSubview:bottomV];
    
    
    UIButton *nextBtn = [[UIButton alloc] initWithFrame:CGRectMake(15, 15, kScreenWidth - 30, 48)];
    nextBtn.titleLabel.font = [UIFont fontWithName:kFuturaMedium size:16];
    [nextBtn setTitleColor:[UIColor colorWithHexString:@"#FFEFC2"] forState:UIControlStateNormal];
    [nextBtn setTitleColor:[UIColor colorWithHexString:@"#FFEFC2"] forState:UIControlStateSelected];
    [nextBtn setTitleColor:[UIColor colorWithHexString:@"#FFEFC2"] forState:UIControlStateHighlighted];
    [nextBtn setTitle:@"Next Step" forState:UIControlStateNormal];
    [nextBtn setTitle:@"Next Step" forState:UIControlStateSelected];
    [nextBtn setTitle:@"Next Step" forState:UIControlStateHighlighted];
    [nextBtn setBackgroundImage:[UIImage imageNamed:@"icon_idf4"] forState:UIControlStateNormal];
    [nextBtn setBackgroundImage:[UIImage imageNamed:@"icon_idf4"] forState:UIControlStateSelected];
    [nextBtn setBackgroundImage:[UIImage imageNamed:@"icon_idf4"] forState:UIControlStateHighlighted];
    [nextBtn addTarget:self action:@selector(clickNextBtn) forControlEvents:UIControlEventTouchUpInside];
    [bottomV addSubview:nextBtn];

}

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.title = @"Verify Identity";
    
    self.tableView.frame = CGRectMake(0, 0, kScreenWidth, kScreenHeight - kFootViewHeight );
    
    [self initFootView];
    

    UIImage *bgImg = [UIImage imageNamed:@"icon_idf"];
    UIImage *bgImg2 = [UIImage imageNamed:@"icon_idf10"];
    UIImage *bgImg3 = [UIImage imageNamed:@"icon_idf9"];
    
    UIView *headView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, bgImg.size.height + DimensionBaseIphone6(bgImg2.size.height) + DimensionBaseIphone6(bgImg3.size.height) + 10 + 15)];
    self.tableView.tableHeaderView = headView;
    
    UIImageView *imgV = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, bgImg.size.height)];
    imgV.image = bgImg;
    [headView addSubview:imgV];
    
    UIImageView *backImgView2 = [[UIImageView alloc] initWithFrame:CGRectMake(15, imgV.bottom + 10, kScreenWidth - 30, DimensionBaseIphone6(bgImg2.size.height))];
    backImgView2.image = bgImg2;
    [headView addSubview:backImgView2];
    
    UIImage *ic1img = [UIImage imageNamed:@"icon_idf5"];
    UIImageView *ic1 = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, backImgView2.size.width, DimensionBaseIphone6(ic1img.size.height))];
    ic1.image = ic1img;
    [backImgView2 addSubview:ic1];
    
    UIImage *ic2img = [UIImage imageNamed:@"icon_idf3"];
    UIImageView *ic2 = [[UIImageView alloc] initWithFrame:CGRectMake((ic1.size.width - DimensionBaseIphone6(ic2img.size.width))/2, (ic1.size.height - DimensionBaseIphone6(ic2img.size.height))/2, ic2img.size.width, DimensionBaseIphone6(ic2img.size.height))];
    ic2.image = ic2img;
    [backImgView2 addSubview:ic2];
    
    UIButton *btn1 = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, backImgView2.size.width/2, ic1.size.height)];
    [btn1 setTitle:[NSString stringWithFormat:@"  %@",esString(self.cardStr)] forState:UIControlStateNormal];
    [btn1 setTitle:[NSString stringWithFormat:@"  %@",esString(self.cardStr)] forState:UIControlStateSelected];
    [btn1 setTitle:[NSString stringWithFormat:@"  %@",esString(self.cardStr)] forState:UIControlStateHighlighted];
    [btn1 setImage:[UIImage imageNamed:@"icon_idf1"] forState:UIControlStateNormal];
    [btn1 setImage:[UIImage imageNamed:@"icon_idf1"] forState:UIControlStateSelected];
    [btn1 setImage:[UIImage imageNamed:@"icon_idf1"] forState:UIControlStateSelected];
    [btn1 setTitleColor:[UIColor colorWithHexString:@"#FFEFC0"] forState:UIControlStateNormal];
    [btn1 setTitleColor:[UIColor colorWithHexString:@"#FFEFC0"] forState:UIControlStateSelected];
    [btn1 setTitleColor:[UIColor colorWithHexString:@"#FFEFC0"] forState:UIControlStateHighlighted];
    btn1.titleLabel.font = [UIFont fontWithName:kFuturaMedium size:13];
    [backImgView2 addSubview:btn1];
    
    
    UIButton *btn2 = [[UIButton alloc] initWithFrame:CGRectMake(btn1.right, 0, backImgView2.size.width/2, ic1.size.height)];
    [btn2 setTitle:[NSString stringWithFormat:@"  %@",@"Face"] forState:UIControlStateNormal];
    [btn2 setTitle:[NSString stringWithFormat:@"  %@",@"Face"] forState:UIControlStateSelected];
    [btn2 setTitle:[NSString stringWithFormat:@"  %@",@"Face"] forState:UIControlStateHighlighted];
    [btn2 setImage:[UIImage imageNamed:@"icon_idf2"] forState:UIControlStateNormal];
    [btn2 setImage:[UIImage imageNamed:@"icon_idf2"] forState:UIControlStateSelected];
    [btn2 setImage:[UIImage imageNamed:@"icon_idf2"] forState:UIControlStateSelected];
    btn2.titleLabel.font = [UIFont fontWithName:kFuturaMedium size:13];
    [btn2 setTitleColor:[UIColor colorWithHexString:@"#F1F3F2"] forState:UIControlStateNormal];
    [btn2 setTitleColor:[UIColor colorWithHexString:@"#F1F3F2"] forState:UIControlStateSelected];
    [btn2 setTitleColor:[UIColor colorWithHexString:@"#F1F3F2"] forState:UIControlStateHighlighted];
    [backImgView2 addSubview:btn2];
    
    UIImage *ic3 = [UIImage imageNamed:@"icon_idf6"];
    UIImageView *ic3imgV = [[UIImageView alloc] initWithFrame:CGRectMake(27, ic1.bottom + DimensionBaseIphone6(14), (backImgView2.size.width - 54), DimensionBaseIphone6(ic3.size.height))];
    ic3imgV.image = ic3;
    [backImgView2 addSubview:ic3imgV];
    
    UIImage *ic4 = [UIImage imageNamed:@"icon_idf8"];
    UIImageView *ic4imgV = [[UIImageView alloc] initWithFrame:CGRectMake(14, ic3imgV.bottom + DimensionBaseIphone6(20), (backImgView2.size.width - 28), DimensionBaseIphone6(ic4.size.height))];
    ic4imgV.image = ic4;
    [backImgView2 addSubview:ic4imgV];
    
    
    UIImage *ic5 = [UIImage imageNamed:@"icon_idf7"];
    self.cardImgView = [[UIImageView alloc] initWithFrame:CGRectMake(21, DimensionBaseIphone6(16), ic3imgV.size.width - 42, DimensionBaseIphone6(ic5.size.height))];
    [ic3imgV addSubview:self.cardImgView];
    self.cardImgView.image = ic5;
    
    self.cardImgView.userInteractionEnabled = YES;
    
    ic3imgV.userInteractionEnabled = YES;
    backImgView2.userInteractionEnabled = YES;
    
    UIButton *photoBtn = [[UIButton alloc] initWithFrame:CGRectMake(0, self.cardImgView.bottom, ic3imgV.size.width, DimensionBaseIphone6(40))];
    [photoBtn setTitle:[NSString stringWithFormat:@"%@",@"  Click To Upload Aadhaar Front"] forState:UIControlStateNormal];
    [photoBtn setTitle:[NSString stringWithFormat:@"%@",@"  Click To Upload Aadhaar Front"] forState:UIControlStateSelected];
    [photoBtn setTitle:[NSString stringWithFormat:@"%@",@"  Click To Upload Aadhaar Front"] forState:UIControlStateHighlighted];
    [photoBtn setImage:[UIImage imageNamed:@"icon_idf11"] forState:UIControlStateNormal];
    [photoBtn setImage:[UIImage imageNamed:@"icon_idf11"] forState:UIControlStateSelected];
    [photoBtn setImage:[UIImage imageNamed:@"icon_idf11"] forState:UIControlStateSelected];
    [photoBtn setTitleColor:[UIColor colorWithHexString:@"#638473"] forState:UIControlStateNormal];
    [photoBtn setTitleColor:[UIColor colorWithHexString:@"#638473"] forState:UIControlStateSelected];
    [photoBtn setTitleColor:[UIColor colorWithHexString:@"#638473"] forState:UIControlStateHighlighted];
    photoBtn.titleLabel.font = [UIFont fontWithName:kFuturaMedium size:13];
    [ic3imgV addSubview:photoBtn];
    [photoBtn addTarget:self action:@selector(clickPhoto) forControlEvents:UIControlEventTouchUpInside];
    
    
    UIImage *botImg = [UIImage imageNamed:@"icon_idf9"];
    UIImageView *botImgV = [[UIImageView alloc] initWithFrame:CGRectMake(15, backImgView2.bottom + 15, kScreenWidth - 30, DimensionBaseIphone6(botImg.size.height))];
    botImgV.image = botImg;
    [headView addSubview:botImgV];
    botImgV.userInteractionEnabled = YES;
    
    UILabel *topLab = [Utility createLabel:[UIFont fontWithName:kFutura size:12] color:[UIColor colorWithHexString:@"#638473"]];
    topLab.text = @"Please Confirm Your Identity Information";
    [botImgV addSubview:topLab];
    topLab.frame = CGRectMake(20, 0, botImgV.size.width - 40, DimensionBaseIphone6(46));
    
    UILabel *lab1 = [Utility createLabel:[UIFont fontWithName:kFuturaMedium size:13] color:[UIColor colorWithHexString:@"#638473"]];
    lab1.text = @"Full Name";
    [botImgV addSubview:lab1];
    lab1.frame = CGRectMake(20, topLab.bottom, 100, DimensionBaseIphone6(44));
    
    self.fullNameFiled = [[CreditTextFiled alloc] initWithFrame:CGRectMake(20, lab1.bottom, botImgV.size.width - 40, DimensionBaseIphone6(44))];
    [botImgV addSubview:self.fullNameFiled];
    self.fullNameFiled.textColor = [UIColor colorWithHexString:@"#022D06"];
    self.fullNameFiled.placeholder = @"Please Enter";
    self.fullNameFiled.font = [UIFont fontWithName:kFuturaMedium size:13];
    [self.fullNameFiled addLeftViewWithTitle:@"" leftMargin:10 leftWidth:10 leftColor:[UIColor clearColor] leftFont:[UIFont systemFontOfSize:10] leftViewMode:UITextFieldViewModeAlways];
    NSMutableAttributedString *placeholderCapString1 = [[NSMutableAttributedString alloc] initWithString:self.fullNameFiled.placeholder attributes:@{NSForegroundColorAttributeName:[UIColor colorWithHexString:@"#F1F3F2"],NSFontAttributeName:[UIFont fontWithName:kFuturaMedium size:13]}];
    self.fullNameFiled.attributedPlaceholder = placeholderCapString1;
    self.fullNameFiled.layer.cornerRadius = 50/2;
    self.fullNameFiled.layer.masksToBounds = YES;
    self.fullNameFiled.layer.borderWidth = 1;
    self.fullNameFiled.layer.borderColor = [UIColor colorWithHexString:@"#F1F3F2"].CGColor;
    
    UILabel *lab2 = [Utility createLabel:[UIFont fontWithName:kFuturaMedium size:13] color:[UIColor colorWithHexString:@"#638473"]];
    lab2.text = @"ID No.";
    [botImgV addSubview:lab2];
    lab2.frame = CGRectMake(20, self.fullNameFiled.bottom, 100, DimensionBaseIphone6(44));
    
    
    self.IDNoFiled = [[CreditTextFiled alloc] initWithFrame:CGRectMake(20, lab2.bottom, botImgV.size.width - 40, DimensionBaseIphone6(44))];
    [botImgV addSubview:self.IDNoFiled];
    self.IDNoFiled.textColor = [UIColor colorWithHexString:@"#022D06"];
    self.IDNoFiled.placeholder = @"Please Enter";
    self.IDNoFiled.font = [UIFont fontWithName:kFuturaMedium size:13];
    [self.IDNoFiled addLeftViewWithTitle:@"" leftMargin:10 leftWidth:10 leftColor:[UIColor clearColor] leftFont:[UIFont systemFontOfSize:10] leftViewMode:UITextFieldViewModeAlways];
    NSMutableAttributedString *placeholderCapString2 = [[NSMutableAttributedString alloc] initWithString:self.IDNoFiled.placeholder attributes:@{NSForegroundColorAttributeName:[UIColor colorWithHexString:@"#F1F3F2"],NSFontAttributeName:[UIFont fontWithName:kFuturaMedium size:13]}];
    self.IDNoFiled.attributedPlaceholder = placeholderCapString2;
    self.IDNoFiled.layer.cornerRadius = 50/2;
    self.IDNoFiled.layer.masksToBounds = YES;
    self.IDNoFiled.layer.borderWidth = 1;
    self.IDNoFiled.layer.borderColor = [UIColor colorWithHexString:@"#F1F3F2"].CGColor;
    
    self.IDNoFiled.keyboardType = UIKeyboardTypeNumberPad;
    
    UILabel *lab3 = [Utility createLabel:[UIFont fontWithName:kFuturaMedium size:13] color:[UIColor colorWithHexString:@"#638473"]];
    lab3.text = @"Date Of Birth";
    [botImgV addSubview:lab3];
    lab3.frame = CGRectMake(20, self.IDNoFiled.bottom, 100, DimensionBaseIphone6(44));
    
    self.DateFiled = [[CreditTextFiled alloc] initWithFrame:CGRectMake(20, lab3.bottom, botImgV.size.width - 40, DimensionBaseIphone6(44))];
    [botImgV addSubview:self.DateFiled];
    self.DateFiled.textColor = [UIColor colorWithHexString:@"#022D06"];
    self.DateFiled.placeholder = @"Please Enter";
    self.DateFiled.font = [UIFont fontWithName:kFuturaMedium size:13];
    [self.DateFiled addLeftViewWithTitle:@"" leftMargin:10 leftWidth:10 leftColor:[UIColor clearColor] leftFont:[UIFont systemFontOfSize:10] leftViewMode:UITextFieldViewModeAlways];
    NSMutableAttributedString *placeholderCapString3 = [[NSMutableAttributedString alloc] initWithString:self.DateFiled.placeholder attributes:@{NSForegroundColorAttributeName:[UIColor colorWithHexString:@"#F1F3F2"],NSFontAttributeName:[UIFont fontWithName:kFuturaMedium size:13]}];
    self.DateFiled.attributedPlaceholder = placeholderCapString3;
    self.DateFiled.layer.cornerRadius = 50/2;
    self.DateFiled.layer.masksToBounds = YES;
    self.DateFiled.layer.borderWidth = 1;
    self.DateFiled.layer.borderColor = [UIColor colorWithHexString:@"#F1F3F2"].CGColor;
    
    self.DateFiled.userInteractionEnabled = NO;
    self.fullNameFiled.userInteractionEnabled = NO;
    self.IDNoFiled.userInteractionEnabled = NO;
    
    UIImageView *rightImgV = [[UIImageView alloc] initWithFrame:CGRectMake(botImgV.frame.size.width - 35 - 16, 0, 16, 14)];
    rightImgV.centerY = self.DateFiled.centerY;
    [botImgV addSubview:rightImgV];
    rightImgV.image = [UIImage imageNamed:@"icon_idf12"];
    
    UIView *shadeV = [[UIView alloc] initWithFrame:self.DateFiled.frame];
    shadeV.userInteractionEnabled = YES;
    shadeV.backgroundColor = [UIColor clearColor];
    [botImgV addSubview:shadeV];
    
    UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(clickDate)];
    [shadeV addGestureRecognizer:tap];
    
    
    UIView *shadeV1 = [[UIView alloc] initWithFrame:self.fullNameFiled.frame];
    shadeV1.userInteractionEnabled = YES;
    shadeV1.backgroundColor = [UIColor clearColor];
    [botImgV addSubview:shadeV1];
    UIView *shadeV2 = [[UIView alloc] initWithFrame:self.IDNoFiled.frame];
    shadeV2.userInteractionEnabled = YES;
    shadeV2.backgroundColor = [UIColor clearColor];
    [botImgV addSubview:shadeV2];
    
    UITapGestureRecognizer *tap1 = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(clickPhoto)];
    [shadeV1 addGestureRecognizer:tap1];
    
    UITapGestureRecognizer *tap2 = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(clickPhoto)];
    [shadeV2 addGestureRecognizer:tap2];
    
    UITapGestureRecognizer *tap3 = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(clickPhoto)];
    [self.cardImgView addGestureRecognizer:tap3];
    
    
    
    
}

- (void)clickPhoto{
    [self.view endEditing:YES];

    PickerTwoView *picker = [[PickerTwoView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, kScreenHeight)];
    [[UIApplication sharedApplication].keyWindow addSubview:picker];
    [picker showBottomView];
    picker.callBackInfoStr = ^(NSInteger num) {
        self.clickTimeStr = [NSString getNowTimeTimestamp:@"yyyyMMdd HH:mm:ss"];
        if (num == 0) {
            [self goPhotograph];
        } else {
            [self goPhotoAlbum];
        }
    };
    
}

#pragma mark ---photograph
- (void)goPhotograph{
  
    if (![StringUtil isCanUseCamera]) {
        return;
    }
    [[ZZYPhotoHelper shareHelper] showImageViewSelcteWithResultBlock:^(id data) {
    
        [self uploadPicture:@"2" withImgData:data];
    
    } withOnlyCamera:YES andDefaultFront:NO];
    
    
}

#pragma mark ---Photoalbum
- (void)goPhotoAlbum{
    [[ZZYPhotoHelper shareHelper] showImageViewSelcteWithResultBlock:^(id data) {
        
        [self uploadPicture:@"1" withImgData:data];
        
    } withOnlyCamera:NO andDefaultFront:NO];
}

- (void)uploadPicture:(NSString *)sneering withImgData:(id)data{

    UIImage *img = (UIImage *)data;
    NSData *imgData = UIImageJPEGRepresentation(img, 0.5);
    
    NSString *path_document = NSHomeDirectory();
    NSString *imgPath = [path_document stringByAppendingString:[NSString stringWithFormat:@"/Documents/%@.png",[NSString getNowTimeTimestamp:@"yyyy-MM-dd HH:mm:ss"]]];
    [UIImagePNGRepresentation(img) writeToFile:imgPath atomically:YES];
    
    NSMutableDictionary *muDic = @{
        @"sneering":sneering,
        @"gardens":esString(self.idStr),
        @"risen":@"11",
        @"smiled":imgPath,
        @"giggling":esString(self.cardStr),
        @"passable":@"",
        @"clearly":@"clearlyUploadIdCard",
        @"shell":@"1",
    }.mutableCopy;
    [CreaditUtilsHelper boxShowLoadWithMessage:@""];
    [CreditServerHelper postCreditPhotoUrl:kUploadPicUrl params:muDic imageData:imgData name:@"smiled" fileName:@"fileName.jpg" mimeType:@"image/jpeg" withProgress:^(double pro) {
        
    } success:^(id response) {
        [CreaditUtilsHelper hideLoadMessageBox];
        DLog(@"====response==%@",response);

        if ([response[@"dim"] integerValue] != kSuccessCode) {
            [CreaditUtilsHelper boxShowErrorWithMessage:esString(response[@"platform"]) duration:2.5f];
                return;
        }
        NSDictionary *dic = response[@"recollecting"];

//        [self.cardImgView sd_setImageWithURL:[NSURL URLWithString:esString(dic[@"exulting"])]];
//        self.cardImgView.contentMode = UIViewContentModeScaleAspectFit;
        
//        self.fullNameFiled.text = esString(dic[@"cambridge"]);
//        self.IDNoFiled.text = esString(dic[@"swallowed"]);
//        self.DateFiled.text = esString(dic[@"tightening"]);
        
        PickerOneView *picker = [[PickerOneView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, kScreenHeight)];
        [picker pickViewWithNameStr:esString(dic[@"cambridge"]) andIDNoStr:esString(dic[@"swallowed"]) andDateStr:esString(dic[@"tightening"])];
        [[UIApplication sharedApplication].keyWindow addSubview:picker];
        [picker showBottomView];
        
        
        picker.callBackInfoStr = ^(NSString * _Nonnull nameStr, NSString * _Nonnull idNoStr, NSString * _Nonnull dateStr) {
//            self.fullNameFiled.text = esString(nameStr);
//            self.IDNoFiled.text = esString(idNoStr);
//            self.DateFiled.text = esString(dateStr);
            
            self.nameStr = esString(nameStr);
            self.idNoStr = esString(idNoStr);
            self.dateStr = esString(dateStr);
            [self goPage];
        };
        
        [CreditServerHelper uploadMaiDianDataStartTimeStr:self.clickTimeStr andEndTimeStr:[NSString getNowTimeTimestamp:@"yyyyMMdd HH:mm:ss"] withTypeStr:@"3" withFirmly:esString(self.idStr) withSmaller:esString([[NSUserDefaults standardUserDefaults] valueForKey:kOrderNumber])];
        
    } failure:^(NSError *error) {
        [CreaditUtilsHelper hideLoadMessageBox];
    }];
}

- (void)clickDate{
    [self clickPhoto];
    return;
    DLog(@"clickDate");
    NSArray *dateArray = [esString(self.DateFiled.text) componentsSeparatedByString:@"/"];
    
    NSString *dateStr = @"";
    if (dateArray.count == 3) {
        dateStr = [NSString stringWithFormat:@"%@/%@/%@",dateArray[2],dateArray[1],dateArray[0]];
    }
    DLog(@"====dateStr===%@",dateStr);
    YearMonthDayPickerView *picker = [[YearMonthDayPickerView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, kScreenHeight) withCurrentSelectYearMonthDayString:dateStr withkOriginYear:1950];
    [[UIApplication sharedApplication].keyWindow addSubview:picker];
    [picker showBottomView];
    
    picker.callBackSelectDateBlock = ^(NSString * _Nonnull dateString) {
        DLog(@"======%@",dateString);
        NSArray *dateArray = [esString(dateString) componentsSeparatedByString:@"/"];
        DLog(@"---dateArray-----%@",dateArray);
        if (dateArray.count == 3) {
            self.DateFiled.text = [NSString stringWithFormat:@"%@/%@/%@",dateArray[2],dateArray[1],dateArray[0]];
        } else {
            self.DateFiled.text = esString(dateString);
        }
     
        
        [self.tableView reloadData];
    };
   
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

- (void)clickNextBtn{
    [self clickPhoto];
    return;
}

- (void)goPage{
    DLog(@"=====%@====%@====%@",self.fullNameFiled.text,self.IDNoFiled.text,self.DateFiled.text);

    NSMutableDictionary *muDic = @{
        @"cambridge":esString(self.nameStr),
        @"swallowed":esString(self.idNoStr),
        @"tightening":esString(self.dateStr),
        @"risen":@"11",
        @"lynch":@"lynchIDCard",
        @"giggling":esString(self.cardStr),
    }.mutableCopy;
    [CreaditUtilsHelper boxShowLoadWithMessage:@""];
    [BaseDataEngine apiForPath:kStoreIDCardUrl method:kPostMethod parameter:muDic onCompleteSuccess:^(NSDictionary *responseDic) {
        [CreaditUtilsHelper hideLoadMessageBox];
        if ([responseDic[@"dim"] integerValue] != kSuccessCode) {
            [CreaditUtilsHelper boxShowErrorWithMessage:esString(responseDic[@"platform"]) duration:2.5f];
                return;
        }
    
        [[NSNotificationCenter defaultCenter] postNotificationName:@"HideAlert" object:nil];
        
        FaceViewController *vc = [[FaceViewController alloc] init];
        vc.cardStr = esString(self.cardStr);
        vc.idStr = esString(self.idStr);
        [self.navigationController pushViewController:vc animated:YES];
        
//        [[NSNotificationCenter defaultCenter] postNotificationName:kNeedRefreshOrderDetNotification object:nil];
        
    } onCompleteFailur:^(NSError *error) {
        [CreaditUtilsHelper hideLoadMessageBox];
    } withIsForm:YES];
    
    
    
}

@end
